Namespace ShapeLibrary
    <Designer(GetType(ShapeLibrary.Design.EllipseDesigner))> _
    Friend Class Ellipse
        Inherits Shape

        Private m_color As Color = SystemColors.WindowText
        Private m_shapeFill As Color = SystemColors.WindowText
        Private m_bounds As Rectangle
        Private m_fillBrush As SolidBrush '= New SolidBrush(Drawing.Color.AliceBlue)

        '''
        ''' The bounds of the ellipse, in pixels.
        '''
        <Description("The bounds of the ellipse in pixels.")> _
        Public Property Bounds() As Rectangle
            Get
                Return m_bounds
            End Get

            Set(ByVal Value As Rectangle)
                m_bounds = Value
            End Set
        End Property

        '''
        ''' The color of the ellipse.
        '''
        <Description("The color of the ellipse.")> _
        Public Property Color() As Color
            Get
                Return m_color
            End Get

            Set(ByVal Value As Color)
                m_color = Value
            End Set
        End Property


        '''
        ''' A fill style for the ellipse.
        '''
        <Description("The pattern and color to fill the ellipse."), _
        DefaultValue(GetType(Color), "None")> _
        Public Property Fill() As Color
            Get
                Return m_shapeFill
            End Get
            Set(ByVal Value As Color)
                m_shapeFill = Value
                m_fillBrush = New SolidBrush(m_shapeFill)
            End Set
        End Property

        '''
        ''' Overrides Shape.Draw
        '''
        Friend Overrides Sub Draw(ByVal g As Graphics)
            Dim p As Pen = New Pen(Color)
            Try
                g.DrawEllipse(p, Bounds)
                If Not (m_fillBrush) Is Nothing Then
                    g.FillEllipse(m_fillBrush, Bounds)
                End If
            Finally

            End Try
        End Sub
    End Class
End Namespace